<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderItemTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_item', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order_id')->default(0)->comment('订单id');
            $table->integer('gid')->default(0)->comment('商品id');
            $table->string('type')->default('goods')->comment('订单类型');
            $table->decimal('price')->default(0)->comment('商品单价');
            $table->string('size')->nullable()->comment('商品尺寸');
            $table->timestamps();
            $table->softDeletes();

        });

        Schema::table('orders', function (Blueprint $table) {
            $table->integer('num')->default(0)->comment('商品总数量')->after('note');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
